const Table = require("../utils/table");
const TableUtil = new Table(
  "tag",
  ["id", "name", "create_time", "update_time"],
  { updateFilterField: ["create_time"] }
);
const $date = require("../utils/date");
module.exports = {
  /**
   * 新增或修改tag
   * @param tag
   * @return {Promise<any>}
   */
  insertOrUpdate: function(tag) {
    const now = $date.format(new Date());
    return TableUtil.insertOrUpdate({
      name: tag,
      update_time: now,
      create_time: now
    });
  }
};
